<TABLE class=design bgColor=#ffffff cellPadding=3 cellSpacing=0 width=100% border='1' BORDERCOLOR="#C0C0C0" STYLE="border-collapse: collapse">
<?php
	if(!isset($_POST)){
		extract($HTTP_POST_VARS);
		extract($HTTP_GET_VARS);
		extract($HTTP_COOKIE_VARS);
		extract($HTTP_ENV_VARS);
		extract($HTTP_SERVER_VARS);
	}else{
		extract($_POST);
		extract($_GET);
		extract($_COOKIE);
		extract($_ENV);
		extract($_SERVER);
	}
	if($what == 'process'){
?>
<tr>
	<td colspan=3>
<?
		$goToIt = 1;
		if($goToIt){
			// Connected to the database server OK
			$strQuery  = "UPDATE forum SET ";
			$strQuery .= "name='$strname', "; 
			$strQuery .= "uid='$strUid', "; 
			$strQuery .= "description='$strdescription' "; 
			$strQuery .= " WHERE id=$bid";
			if(mysql_query($strQuery)){
?>
				<span class="title">Forum Updated</span><br><br>
				You have sucsessfully updated this Forum.
				<a href="<?=$PHP_SELF?>?a=<?=$a?>">Continue</a>
<?php
			}
		}else{
	?>
			<span class="title">Error</span><br><br>
			Sorry, but the passwords you supplied did not match. Please use the link below to return.<br><br>
			<a href="javascript:history.back(-1);">Back</a>
<?php
		}
?>
	</td>
</tr>
<?
	}else{
		$sql = "SELECT * FROM forum WHERE id=$bid";
		$qr1 = mysql_query($sql);
		extract( mysql_fetch_array($qr1) );
?>
		<form action="<?=$PHP_SELF?>" method="post" name="form1">
		<input type="hidden" name="what" value="process">
		<input type="hidden" name="a" value="<?=$a?>">
		<input type="hidden" name="step" value="<?=$step?>">
		<input type="hidden" name="bid" value="<?=$bid?>">
		<tr>
			<td colspan="3">
				<div align="center"><strong><font color="#0066CC" size="3" face="Verdana, Arial, Helvetica, sans-serif">Edit Forum</font></strong></div>
			</td>
		</tr>
		<tr>
			<td>
				<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">name&nbsp;&nbsp;</strong>
			</td>
			<td><input size=55 type="text" name="strname" value="<?=$name?>"></td>
		</tr>
		<tr>
			<td>
				<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Owner&nbsp;&nbsp;</strong>
			</td>
			<td>
				<select name="strUid">
					<option value="0">-- Choose a User --
<?
					userList($sel);
?>
				</select>
			</td>
		</tr>
		<tr>
			<td>
				<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">description&nbsp;&nbsp;</strong>
			</td>
			<td><input size=55 type="text" name="strdescription" value="<?=$description?>"></td>
		</tr>
		<tr>
			<td colspan="3"><hr width="100%" size="1" color="#66B0DC"></td>
		</tr>
		<tr>
			<td colspan="3">
				<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;
					<input type="submit" alt="submit" width="66" height="20" hspace="5" vspace="5" border="0">
					<input type="reset" alt="submit" width="66" height="20" hspace="5" vspace="5" border="0">
				</font></div>
			</td>
		</tr>
		</form>
<?php
	}
?>
</table>
<?
	function userList($sel){
		$sql = "SELECT * FROM users";
		$result = mysql_query($sql) or die( mysql_error() );
		if ($result){
			while( $row = mysql_fetch_object($result) ){
				$sela = "";
				if($row->uid == $sel) $sela = "SELECTED";
?>
				<option value="<?=$row->uid?>" <?=$sela?>><?=$row->username?> - <?=$row->email?></option>
<?
			}
		}
	}
?>